Skip to content

feat(id): id serve loads ServerConfig + startup provisioning (#5119 slice 1) - #5187

Merged
dezren39 merged 1 commit into
mainfrom
queue/8839-5119-serve-serverconfig
Nov 3, 2026
Merged

dezren39 merged 1 commit into
mainfrom
queue/8839-5119-serve-serverconfig

Conversation

@dezren39

@dezren39 dezren39 commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

Slice 1 of #5119 (task 8839): the foundation that lets id serve consume ServerConfig at all — previously ServerConfig::load and Provisioned::apply had no production caller.

What

  • --server-config <path> on id serve, in the existing CLI style (cli.rs → main.rs → ServeOptions → cmd_serve).
  • When the flag is given, serve loads the config before any startup work via the new start_server_config: read/parse failures fail startup naming the ServerConfig::parse error and the path (the parser's startup-failing contract), and Provisioned::apply runs from the loaded config, with the report (users/groups/members created) on the startup status line.
  • The loaded config + provisioning stay in startup scope (StartedServerConfig) so slice 2 (pull gate from config.pull_policy()) and slice 3 (freshness into seitan admission) wire in from this one load.
  • No flag = no file read and exactly today's behaviour. On a binary built without the world feature (which owns server_config), the flag fails loudly, mirroring the existing --web guard.

Tests (laptop, pkgs/id)

  • cargo test --lib -- server_config — 60 passed, including the 4 new serve tests:
    • start_server_config_applies_provisioning — a valid config loads; provisioning creates 2 users / 1 group / 1 member; a second apply over the same state creates nothing.
    • start_server_config_fails_startup_on_a_malformed_file — the parse error is named, with the path.
    • start_server_config_fails_startup_on_a_missing_file.
    • serve_server_config_flag_defaults_to_none — flag absent = None; --server-config ops.toml parses through.
  • cargo test --lib -- commands::serve — 37 passed.
  • rustfmt --edition 2024 clean on the touched file.

Out of scope per the slice definition: pull gate from config (slice 2), freshness wiring (slice 3), parse-surface changes.


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

…lice 1)

Adds --server-config <path> to id serve (cli.rs -> ServeOptions -> cmd_serve). When given, serve loads the config before any startup work via start_server_config: ServerConfig::load failures fail startup naming the parse error and path, and Provisioned::apply runs from the loaded config with the report on the startup status line. The loaded config/provisioning stay in startup scope for the pull-gate and freshness slices. No flag = no file read, behaviour unchanged. Without the world feature the flag fails loudly like --web does. Tests: provisioning applied (2 users/1 group/1 member, idempotent second apply), malformed and missing files fail startup, flag defaults to None.
@dezren39
dezren39 requested a review from a team as a code owner November 3, 2026 22:21
@coderabbitai

coderabbitai Bot commented Nov 3, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 10 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 48de8546-9b30-4fec-bcee-51b928ac40b3
Commits

Reviewing files that changed from the base of the PR and between 00d7ef5 and 30f0bf9.

Files selected for processing: 3
  • pkgs/id/src/cli.rs
  • pkgs/id/src/commands/serve.rs
  • pkgs/id/src/main.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-03T22:24:37.899446Z 30f0bf9 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 30f0bf9857

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +907 to +909
let mut provisioned = crate::server_config::Provisioned::new();
let report = provisioned
.apply(&config)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Apply provisioning to the live server state

When --server-config declares users or groups, provisioning runs against a fresh, isolated Provisioned, and the returned state is retained only in the unused _started_server_config binding. The running server instead builds its state independently in ServeWorlds::open_world, loads durable accounts from directory.jsonl in world_store::open_world, and reads group membership through GroupLog. Consequently, startup reports successful provisioning without making the configured accounts or groups available to live serving, and each restart reports them newly created again. Apply provisioning to the actual serving state and persist it where appropriate; this is separate from the explicitly deferred pull-policy and freshness wiring.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed with the observation; dispositioned as a scoped follow-on rather than silently merged past. Slice 1 (this PR) implements exactly the boundary its packet defined (triage task 8786, packet on task 8839): serve loads the ServerConfig through --server-config, startup fails on a malformed file naming the parse error, and Provisioned::apply executes at startup — the first production caller either function has had, with the loaded state kept in startup scope for the wiring slices. Persisting provisioning into the live stores is a distinct design step (GroupLog has no append for already-formed events — provisioned events carry precomputed ids; directory state is applied from directory.jsonl records; config-derived events are unsigned because the config holds public keys only), so it is filed as slice 1b on #5119 with the full scope, evidence, and a packet draft, to land ahead of slices 2/3. This PR merges as the verified slice-1 foundation; 1b is tracked on the issue, not dropped.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant